<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">
 		<title></title>
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<jsp:include page="/page/front/include.jsp"></jsp:include>
		<link rel="stylesheet" type="text/css" href="css/front/login.css" />
		<link rel="stylesheet" type="text/css" href="css/front/check.css" />
		<script type="text/javascript" src="lib/jquery.js"></script>
	</head>
	<body class="login">
		<jsp:include page="/page/front/header.jsp" flush="true">
			<jsp:param name="login" value="login" />
		</jsp:include>
		<div class="body">
			<div class="loginDetail">
				<div class="top">会员登录</div>
				<div class="middle">
					<form onsubmit="return false;">
						<table>
							<tr>
								<th>用户名</th>
								<td>
									<input type="text" id="signInName" name="signInName" class="formText" onblur="isloginUsername(this.value);"/>
								</td>
							</tr>
							<tr ><th></th><td><div id="checkloginusername" class="item_error"></div></td></tr>
							<tr>
								<th>密&nbsp;&nbsp;&nbsp;码</th>
								<td>
									<input type="password" id="password" name="password" class="formText" onblur="isloginPassword(this.value);"/>
								</td>
							</tr>
							<tr><th></th><td><div id="checkloginpassword" class="item_error"></div></td></tr>
							<tr>
								<th>验证码</th>
								<td>
									<input type="text" id="loginCaptcha" name="j_captcha" class="formTextS" onblur="isloginCaptcha(this.value);"/>
									<img id="loginCaptchaImage" src="page/front/image.jsp" title="点击更换验证码" onclick="loadloginimage();" />
								</td>
							</tr>
							<tr><th></th><td><div id="checklogincaptcha" class="item_error"></div></td></tr>
							<tr>
								<th>&nbsp;</th>
								<td>
									<span class="warnIcon">&nbsp;</span><a href="">忘记了密码? 点击找回!</a>
								</td>
							</tr>
							<tr>
								<th>&nbsp;</th>
								<td>
									<input type="submit" value="登 录" hidefocus="true" class="submitButton" onclick="login();" />
									<input type="reset" value="清空" hidefocus="true" class="submitButton" />
								</td>
							</tr>
						</table>
						<p id="error"></p>
					</form>
				</div>
				<div class="bottom"></div>
			</div>
		</div>
		<script type="text/javascript">
			var url = '<s:property value="#session.url" escape="false" />';
			<s:if test="#session.parameterNames==null">
			var names = null;
			var values = null;
			</s:if><s:else>
			var names = <s:property value="#session.parameterNames" escape="false" />;
			var values = <s:property value="#session.parameterValues" escape="false" />;
			</s:else>
			
			function loginCallback(data, e) {
				if (data == "success") {
					showMessage(e, "登录成功");
					setTimeout("redirectToUrl(url, names, values);", 3800);
				} else {
					$("#error").html(data);
				}
			}
			
			function redirectToUrl(url, names, values) {
				if (names == null) {
					window.location.href = url;
				} else {
					var form = document.createElement("form");
					form.setAttribute("method", "post");
					form.setAttribute("action", url);
					for (var i=0; i<names.length; i++) {
						var hiddenField = document.createElement("input");
						hiddenField.setAttribute("type", "hidden");
						hiddenField.setAttribute("name", names[i]);
						hiddenField.setAttribute("value", values[i]);
						form.appendChild(hiddenField);
					}
					document.body.appendChild(form);
					form.submit();
				}
			}
		</script>
		<jsp:include page="/page/front/footer.jsp"></jsp:include>
	</body>
</html>
